import BuffUtil from '@/BuffUtil';
import Buff from '@/Buff';

import ItemUtil from '@/ItemUtil';
export default class Item_毒液之球 {
    static id = 'oven';
    static 名称: string = '毒液之球';
    static 描述: string = '移动和生命回复降低，并且持续受到毒性伤害';
    static 图标: string = 'ReplaceableTextures\\CommandButtons\\BTNOrbOfVenom.blp';
    static buffId: string = 'buff_item_duyeqiu';
    static buffType: AppBuffType = {
        id: 'buff_item_duyeqiu',
        name: Item_毒液之球.名称,
        ubertip: Item_毒液之球.描述,
        art: Item_毒液之球.图标,
        attribute: {
            move_speed: 10,
            生命恢复增强: -0.1,
        },
        dur: 4,
        onInterval: Item_毒液之球.buffInterval,
        interval: 1,
        isDebuff: true,
    };
    static buffInterval(buff: Buff) {
        DamageSystemInstance.applyPoisionDamage(buff.getParent(), buff.getParent(), 5);
    }
    static 添加技能(目标: unit) {
        UnitAddAbility(目标, Item_毒液之球.id);
    }
    static 释放(x: number, y: number, 来源?: unit, 目标?: unit, d?: any) {
        BuffUtil.addBuff(目标, Item_毒液之球.buffId, 来源);
    }
    constructor() {
        BuffUtil.registerBuffType(Item_毒液之球.buffType);
        EventManager.onTakeAttack(Item_毒液之球.spellEffect);
    }
    static spellEffect(d: DamageEventData) {
        if (!ItemUtil.isUnitHasItem(d.source, 'oven')) return;
        Item_毒液之球.释放(0, 0, d.source, d.target, d);
    }
}
